﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.S.XZYData.Domain.ZSH
{
    /// <summary>
    /// 流程业务实例（完工单）
    /// </summary>
    [Table("workflowinstancemodel")]
    public class WorkflowInstanceModel
    {
        /// <summary>
        /// 主键，唯一标识
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        /// <summary>
		/// 业务编号
		/// </summary>
		[SugarColumn(Length = 50)]
        public string WorkOrderCode { get; set; }

        /// <summary>
        /// 唯一工单编号
        /// </summary>
        [SugarColumn(Length = 50, IsNullable = false)]
        public string WorkOrderNo { get; set; }

        /// <summary>
        /// 工序名称
        /// </summary>
        [SugarColumn(Length = 100, IsNullable = false)]
        public string ProcessName { get; set; }

        /// <summary>
        /// 工序编码（关联系统主数据）
        /// </summary>
        [SugarColumn(Length = 50, IsNullable = false)]
        public string ProcessCode { get; set; }


        /// <summary>
        /// 流程标题
        /// </summary>
        [SugarColumn(Length = 100, IsNullable = false)]
        public string Title { get; set; } = null!;
        /// <summary>
        /// 流程实例id'
        /// </summary>
        [SugarColumn(Length = 100, IsNullable = false)]
        public string WorkflowId { get; set; } = null!;
        /// <summary>
        /// 流程当前的审批步骤id
        /// </summary>
        [SugarColumn(Length = 100, IsNullable = true)]
        public string? StepId { get; set; }
        /// <summary>
        /// 流程当前的审批步骤名称
        /// </summary>
        [SugarColumn(Length = 100, IsNullable = true)]
        public string? StepName { get; set; }
        /// <summary>
        /// 审批人id
        /// </summary>
        [SugarColumn(Length = 100, IsNullable = true)]
        public string? AuditUserId { get; set; }
        /// <summary>
        /// 审批人名称
        /// </summary>
        [SugarColumn(Length = 100, IsNullable = true)]
        public string? AuditUserName { get; set; }
        /// <summary>
        /// 流程模版标识
        /// </summary>
        [SugarColumn(Length = 100, IsNullable = false)]
        public string DefinitionId { get; set; } = null!;
        /// <summary>
        /// 流程模版
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public int Version { get; set; }
        /// <summary>
        /// 发起人
        /// </summary>
        [SugarColumn(Length = 100, IsNullable = false)]
        public string ApplicantUserName { get; set; } = null!;
        /// <summary>
        /// 流程发起的表单数据
        /// </summary>
        [SugarColumn(ColumnDataType = "text", IsNullable = true)]
        public string? FormData { get; set; }
        /// <summary>
        /// 状态 发起 处理中 驳回 通过
        /// </summary>
        [SugarColumn(Length = 100, IsNullable = false)]
        public string Status { get; set; } = null!;
        /// <summary>
        /// 完成时间
        /// </summary>
        [SugarColumn(ColumnName = "CompletedTime", IsNullable = true)]
        public DateTime? CompletedTime { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 创建人ID（关联User.Id）
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public int CreatorId { get; set; }

        /// <summary>
        /// 最后修改时间
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public DateTime? ModifyTime { get; set; }

        /// <summary>
        /// 最后修改人ID（关联User.Id）
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int? ModifierId { get; set; }

        /// <summary>
        /// 伪删除标记（false=未删除，true=已删除）
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public bool IsDeleted { get; set; } = false;
    }
}
